package com.easy.easylibdemo.ui.okgo.model;

import android.support.annotation.Nullable;

import com.easy.easylibdemo.http.HttpUtils;
import com.easylib.okhttp.IOnHttpListener;
import com.easylib.okhttp.ResultCallback;
import com.easylib.utils.DateFormatUtils;
import com.easylib.utils.LogUtils;
import com.easylib.utils.NetworkUtils;
import com.lzy.okhttputils.model.HttpParams;
import com.lzy.okhttputils.request.BaseRequest;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Request;
import okhttp3.Response;
import okio.Buffer;

/**
 * 作　　者: guyj
 * 修改日期: 2016/11/28
 * 描　　述: 获取token的接口实现类
 * 备　　注:
 */
public class RegisterUuid4AppImpl implements RegisterUuid4AppModel {
    @Override
    public void getRegisterUuid4AppBean(String uuid, final IOnHttpListener listener) {
        HttpUtils.getInstance().registerUuid4App(uuid, new ResultCallback<RegisterUuid4AppBean>() {
            @Override
            public void onBefored(BaseRequest request) {
                listener.onBefore();
            }

            @Override
            public void onAfter(@Nullable RegisterUuid4AppBean registerUuid4AppBean, @Nullable Exception e) {
                listener.onAfter();
            }

            @Override
            public void onCacheSuccess(RegisterUuid4AppBean registerUuid4AppBean, Call call) {
                listener.onCache(registerUuid4AppBean);
            }

            @Override
            public void onErrored(Call call, Response response, Exception e) {
                listener.onError(response,e);
            }

            @Override
            public void onSuccess(RegisterUuid4AppBean registerUuid4AppBean, Call call, Response response) {
                listener.onSuccess(registerUuid4AppBean);
            }
        });
    }



}
